package com.shop.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.shop.dao.ProductDao;
import com.shop.entity.Product;
import com.shop.entity.ProductCategory;
import com.shop.service.ProductService;
@Service
@Transactional
public class ProductServiceImpl implements ProductService{
	
	@Autowired
	private ProductDao productDao ;
	
	public ProductDao getProductDao() {
		return productDao;
	}

	public void setProductDao(ProductDao productDao) {
		this.productDao = productDao;
	}
	
	@Override
	public List<Product> findAllProduct() {
		return productDao.findAllProduct();
	}

	@Override
	public Serializable addProduct(Product product) {
		
		return productDao.addProduct(product);
	}

	@Override
	public Serializable deleteProduct(Product product) {
		return productDao.deleteProduct(product);
		
	}

	@Override
	public Serializable updateProduct(Product product) {
		return productDao.updateProduct(product);
	}

	@Override
	public Product selectProduct(Product product) {
		return productDao.selectProduct(product);
	}

	@Override
	public List<Product> selectProductByType(ProductCategory productCategory) {
		List<Product> plist = productDao.selectProductByType(productCategory);
		return plist;
	}

	@Override
	public int count(ProductCategory productCategory) {
		return productDao.count(productCategory);
		
	}

	@Override
	public List<Product> selectProductByTypePage(ProductCategory productCategory,
			int pageindex, int pagesize) {
		return productDao.selectProductByTypePage(productCategory, pageindex, pagesize);
	}
	
	

}
